package com.gxuwz.PangGuangyao.business.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gxuwz.PangGuangyao.business.dao.SysSchoolDAO;
import com.gxuwz.PangGuangyao.business.entity.SysSchool;
import com.gxuwz.PangGuangyao.business.entity.SysSchool;
import com.gxuwz.core.pagination.Result;

@Service("sysSchoolService")
public class SysSchoolServiceImpl implements ISysSchoolService {

	@Autowired
	private SysSchoolDAO sysSchoolDAO;
	
	@Override
	public List<SysSchool> getSchoolAll() {
		return sysSchoolDAO.getAllSchool();
	}
	@Override
	public Result<SysSchool> find(SysSchool sysSchool, int page, int row) {
		return sysSchoolDAO.find(sysSchool, page, row);
	}
	@Override
	public void add(SysSchool sysSchool) {
		sysSchoolDAO.save(sysSchool);	
	}
  @Override
	public SysSchool findById(String schoolId) {
		return  sysSchoolDAO.get(SysSchool.class, schoolId);
	}
  @Override
	public void update(SysSchool sysSchool) {
	  sysSchoolDAO.update(sysSchool);
	}
@Override
	public void delete(String id) {
	sysSchoolDAO.remove(findById(id));
	}
  @Override
	public String checkSchoolId(String schoolId) {
		SysSchool sysSchool = sysSchoolDAO.get(SysSchool.class, schoolId);
		if(null != sysSchool){
			return "no";
		}else{
			return "ok";
		}
	}

}
